Page({

  /**
   * 页面的初始数据
   */
  data: {
    navbarActiveIndex: 0,
    navbarTitle: [
      "推荐 ",
      "业界",
      "数据",
      "业绩",
      "政策法规",
      "市场"
    ]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },
  /**
     * 生命周期函数--监听页面显示
     */
  onShow: function () {
    var that = this;
    wx.request({
      url: 'http://www.recruit.com/api/infomation/infomationList',
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        that.setData({ info: res.data });
      }
    })
  },
  /**
   * 点击导航栏
   */
  onNavBarTap: function (event) {
    var that=this;
    // 获取点击的navbar的index
    let navbarTapIndex = event.currentTarget.dataset.navbarIndex
    wx.request({
      url: 'http://www.recruit.com/api/infomation/infoType', // 仅为示例，并非真实的接口地址
      data: {type: navbarTapIndex},
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        that.setData({info:res.data});
      }
    })
    // 设置data属性中的navbarActiveIndex为当前点击的navbar
    this.setData({
      navbarActiveIndex: navbarTapIndex
    })
  },

  /**
   * 
   */
  onBindAnimationFinish: function ({ detail }) {
    // 设置data属性中的navbarActiveIndex为当前点击的navbar
    this.setData({
      navbarActiveIndex: detail.current
    })
  },
  nice1: function (e) {
    var id = e.currentTarget.dataset.tid
    wx.navigateTo({
      url: "../xq/xq?id="+id,
    })
  }
})